<?php 
session_start();
ob_start();
    require_once './config.php';
    require_once './includes/cls/class.conexao.php'; //Inclui a classe de conexão com o banco de dados;
    require_once './includes/cls/class.usuario.php'; //Inclui a classe de controle de usuários;
    require_once './includes/cls/twitteroauth.php'; //Incluir a classe de autenticação do Twitter;

    //Verifica se já existe o cookie de login. Se não existir, direciona para a página de login;
    if(!$_COOKIE['acesso']) {
            $url_ok = $_SERVER[QUERY_STRING];
            header("Location: login.php?$url_ok");
    }
    //Link de logout;
    if (isset($_GET['logout']) == 1) {
        $usuario = new Usuario();
        $usuario->logout('http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']); 
    }

    //if (!isset($_SESSION['access_token'])) {
    //    header('Location: ./?logout=1');
    //}
        
    $access_token = $_SESSION['access_token'];
    
    $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<title>Marlon Lenck Pacheco</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel='stylesheet' type='text/css' href='./includes/css/index.css' />
</head>
<body>
<div id='geral'>
    <header id="header"><?php include 'header.php' ?></header>
    <section id='body'>
        <nav id='menu' class='cantos'><?php include 'menu.php' ?></nav>
        <section id='content' class='cantos'><?php include 'content.php' ?></section>
        <div class='clear'>&nbsp;</div>    
    </section>
	<footer id='footer'><?php include 'footer.php' ?></footer>	
</div>
</body>
</html>